#!/bin/bash
VERSION=`date '+%Y%m%d'`
ARCH=i486	
PKG=odcommon
USR="--owner 1000 --group 1000 --same-permissions "
EXCLUDE=" --exclude '*~' --exclude .svn "

cd libraries
make clean && make || exit 1
cd ..

echo "Common files" > pkg/$PKG.desc
cp pkg/*.desc ./var/pkg


chmod o-rwx -R usr/local/opendomo/services/control/setSystemState.sh
chmod o-rwx -R usr/local/opendomo/services/config/system
chmod o-rwx -R usr/local/opendomo/services/config/network

rm -fr pkg/o*.tar.gz

chmod o-rwx usr/local/opendomo/services/config/*.sh
tar cfz ./pkg/$PKG-$VERSION.od.$ARCH.tar.gz var etc usr $USR $EXCLUDE


